from xinference.client import Client
import base64
import time
client = Client("http://0.0.0.0:6006")

model = client.get_model("CogVideoX-5b")
input_text = "A panda, dressed in a small, red jacket and a tiny hat, sits on a wooden stool in a serene bamboo forest. The panda's fluffy paws strum a miniature acoustic guitar, producing soft, melodic tunes. Nearby, a few other pandas gather, watching curiously and some clapping in rhythm. Sunlight filters through the tall bamboo, casting a gentle glow on the scene. The panda's face is expressive, showing concentration and joy as it plays. The background includes a small, flowing stream and vibrant green foliage, enhancing the peaceful and magical atmosphere of this unique musical performance."
out = model.text_to_video(input_text)

video_data = base64.b64decode(out['data'][0]['b64_json'])
with open('./'+str(time.time())+'.mp4', 'wb') as fout:
      fout.write(video_data)